#include <bits/stdc++.h>
using namespace std;
const int N = 300001;
using LL = long long;
int main() {
  int n;
  cin >> n;
  LL s1 = 0, s2 = 0, s3 = 0, s4 = 0;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    int he = a + b;
    int cha = a - b;
    if (he > 0) {
      s1 += he;
    } else {
      s2 += -he;
    }
    if (cha > 0) {
      s3 += cha;
    } else {
      s4 += -cha;
    }
  }
  LL ans = max(max(s1, s2), max(s3, s4));
  cout << ans;
  return 0;
}